﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace WindowsGame2
{
    public class ModelManager : Microsoft.Xna.Framework.DrawableGameComponent
    {
        List<BasicModel> models = new List<BasicModel>();
        Game1 game;

        public ModelManager(Game game)
            : base(game)
        {
        }



        protected override void LoadContent()
        {
            models.Add(new BasicModel(Game.Content.Load<Model>(@"model\spaceships.x")));
            
            base.LoadContent();
        }

        public override void Update(GameTime gameTime)
        {
            for (int i = 0; i < models.Count; i++)
            {
                models[i].Update();
            }

            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            foreach (BasicModel basicmodel in models)
            {
                basicmodel.Draw(game.view, game.projection);
            }
            base.Draw(gameTime);
        }

        public Vector3 GetPlayer()
        {
            return new Vector3 (models[0].GetWorld().M41, 
                models[0].GetWorld().M42,
                models[0].GetWorld().M43);

        }

    }
}
